package com.itheima.stream流.实例;

import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Demo5 {
    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<Integer>();
        Collections.addAll(list,2,4,6,8,0);
        list.add(0);
        list.add(0);
        list.add(0);
        List<Integer> collect = list.stream().collect(Collectors.toList());
        LinkedList<Integer> llist=new LinkedList<>(collect);
        System.out.println(llist);
        System.out.println(".......................");
        System.out.println(collect);
        System.out.println("==========================");
        Set<Integer> collect1 = list.stream().collect(Collectors.toSet());
        System.out.println(collect1);
        System.out.println(".......................");
        TreeSet<Integer> set=new TreeSet<>(collect1);
        System.out.println(set);
        Stream<Integer> concat = Stream.concat(list.stream(), set.stream());
        concat.forEach(s-> System.out.println(s));

    }
}
